#!/bin/bash

copy_conf () {
    cp postgresql.conf pg_hba.conf /usr/local/pgsql-14.x-data/
}

echo 'start to copy conf...'

copy_conf

if [ "$?" -ne 0 ] ; then
    sudo copy_conf
fi

echo 'try to restart service...'

sudo systemctl restart cdpcd.service

if [ "$?" -eq 0 ] ; then
    echo 'ok'
fi
